package temp.lho.lws.result;

import temp.lho.lws.emum.MsgStatusEmum;

/**
 * @Classname ResultBody
 * @Description TODO
 * @Date 2020/2/21 15:23
 * @Created by x1c
 */

public class ResultBody {
	/**
	 * 响应代码
	 */
	private Integer code;

	/**
	 * 响应消息
	 */
	private String msg;

	/**
	 * 响应结果
	 */
	private Object data;


	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	/**
	 * 返回一个消息提示
	 * @param msg
	 * @return
	 */
	public static ResultBody toResultBody(Integer code,String msg) {
		ResultBody rb = new ResultBody();
		rb.setCode(code);
		rb.setMsg(msg);
		return rb;
	}

	/**
	 * 返回一个消息提示
	 * @param msg
	 * @return
	 */
	public static ResultBody toResultBody(String msg) {
		ResultBody rb = new ResultBody();
		rb.setMsg(msg);
		return rb;
	}

	/**
	 * 获取要返回的请求对象
	 * @param code
	 * @param msg
	 * @param data
	 * @return
	 */
	public static ResultBody toResultBody(Integer code, String msg ,Object data) {
		ResultBody rb = new ResultBody();
		rb.setCode(code);
		rb.setMsg(msg);
		rb.setData(data);
		return rb;
	}



}
